﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Gufa.EntityFrameworkCore.Migrations
{
    /// <inheritdoc />
    public partial class AddAwardTable : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropCheckConstraint(
                name: "CK_DelFlag_Values",
                table: "T_Teches");

            migrationBuilder.AlterColumn<string>(
                name: "TechName",
                table: "T_Teches",
                type: "nvarchar(20)",
                maxLength: 20,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(10)",
                oldMaxLength: 10);

            migrationBuilder.CreateTable(
                name: "T_Awards",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    AwardName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
                    AwardingInstitution = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    AwardDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AwardDate = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DelFlag = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Awards", x => x.Id);
                    table.CheckConstraint("CK_DelFlag_Values", "DelFlag IN (0, 1)");
                });

            migrationBuilder.AddCheckConstraint(
                name: "CK_DelFlag_Values1",
                table: "T_Teches",
                sql: "DelFlag IN (0, 1)");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "T_Awards");

            migrationBuilder.DropCheckConstraint(
                name: "CK_DelFlag_Values1",
                table: "T_Teches");

            migrationBuilder.AlterColumn<string>(
                name: "TechName",
                table: "T_Teches",
                type: "nvarchar(10)",
                maxLength: 10,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(20)",
                oldMaxLength: 20);

            migrationBuilder.AddCheckConstraint(
                name: "CK_DelFlag_Values",
                table: "T_Teches",
                sql: "DelFlag IN (0, 1)");
        }
    }
}
